package com.dating.base.dto;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Pager extends org.nutz.dao.pager.Pager{

	private static final long serialVersionUID = 3631262862147462480L;
	
	//请求参数
	Map<String, Object> params = new HashMap<String, Object>();
	
	//分页长度
	private int barLength ;
	
	//分页列表集合
	private List<?> pageRows ;
	
	//合并列表集合（total）
	private List<?> mergeRows ;

	//排序字段
	private String orderBy ;
	
	//排序方式 (desc 倒序， asc 升序)
	private String sortDesc = "desc" ;

	//构造函数
	public Pager() {
		super();
	}
	
	//带参数构造函数
	public Pager(int pageNumber, int pageSize ){
		super();
		this.setPageNumber(pageNumber);
		this.setPageSize(pageSize);
	}
	
	/**
	 * 分页标签
	 * @return
	 */
	public String genPagerBar(){
		StringBuilder  bar = new StringBuilder();
		bar.append("<ul class='pagination pull-right no-margin'>");
		for (int i = 1; i <= this.getPageCount(); i++) {
			if(i == this.getPageNumber()) {
				bar.append("<li class='active'><a href='#'>"+ i +"</a></li>");
			}else {
				bar.append("<li><a href='#'>"+ i +"</a></li>");
			}
		}
		bar.append("</ul>");
		return bar.toString();
	}
	
	
	public List<?> getPageRows() {
		return pageRows;
	}

	public void setPageRows(List<?> pageRows) {
		this.pageRows = pageRows;
	}

	public List<?> getMergeRows() {
		return mergeRows;
	}

	public void setMergeRows(List<?> mergeRows) {
		this.mergeRows = mergeRows;
	}

	public String getOrderBy() {
		return orderBy;
	}

	public void setOrderBy(String orderBy) {
		this.orderBy = orderBy;
	}

	public String getSortDesc() {
		return sortDesc;
	}

	public void setSortDesc(String sortDesc) {
		this.sortDesc = sortDesc;
	}

	public Map<String, Object> getParams() {
		return params;
	}

	public void setParams(Map<String, Object> params) {
		this.params = params;
	}

	public int getBarLength() {
		return barLength;
	}

	public void setBarLength(int barLength) {
		this.barLength = barLength;
	}
	
	
}
